package com.changdu.seatunnel.admin.config.common;

import com.changdu.seatunnel.admin.config.enums.HttpResponseStatus;

public class BusinessException extends RuntimeException {
	
	private static final long serialVersionUID = 5468122937751046392L;

	public BusinessException(Throwable cause) {
		super(cause);
	}

	public BusinessException(String message) {
		super(message);
	}

	public BusinessException(HttpResponseStatus status) {
		super(status.getReasonPhrase());
		this.code = status.value();
	}	
	
	public BusinessException(ExceptionInterface enmus) {
		super(enmus.getMessage());
		this.code = enmus.getCode();
	}

	public BusinessException(Integer code, String message) {
		super(message);
		this.code = code;
	}

	public BusinessException(Integer code, String message, Throwable cause) {
		super(message, cause);
		this.code = code;
	}

	/**
	 * 业务定义的异常错误码
	 */
	private Integer code;
	
	/**
	 * debug 输出日志
	 */
	private Object original;

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public Object getOriginal() {
		return original;
	}

	public void setOriginal(Object original) {
		this.original = original;
	}
	
}